package zhy.use_view_scroll;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class UseViewScrollActivity extends Activity {
    
	View view;
	Button up,down;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.use_view_scroll);
        view=findViewById(R.id.text);
       
        OnClickListener listener=new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				switch (v.getId()) {
				case R.id.up:
					view.scrollBy(0, 25);
					break;
				case R.id.down:
					view.scrollBy(0, -50);
					break;

				default:
					break;
				}
			}
		};
        up=(Button)findViewById(R.id.up);
        up.setOnClickListener(listener);
        down=(Button)findViewById(R.id.down);
        down.setOnClickListener(listener);
    }
}